package opn.srn.common;

import java.util.HashMap;
import java.util.Map;

public abstract class Factory<K, V, I> {

	protected Map<K, V> factory = new HashMap<K, V>();

	public void register(K key, V value) {
		factory.put(key, value);
	}

	public void unregister(K key) {
		factory.remove(key);
	}

	public boolean isRegistered(K key) {
		return factory.containsKey(key);
	}

	public abstract I newInstance(K key) throws Exception;

}
